﻿#ifndef __INC_QG_D11_DRAW_H__
#define __INC_QG_D11_DRAW_H__

#ifdef _MSC_VER
#pragma once
#endif

//////////////////////////////////////////////////////////////////////////
// 버퍼
class D11Buffer : public qgBuffer
{
	KCH_SUBCLASS(D11Buffer, qgBuffer);
	KCH_FRIEND(D11Device);

private:
	D3D11_BUFFER_DESC	_desc;

	kpointer			_lock;

	ID3D11Buffer*		_tmpbuf;
	bool				_upload;

private:
	D11Buffer() throw();
	~D11Buffer() throw();

public:
	K_OVR kpointer EnterMap(kint flags);
	K_OVR bool LeaveMap();

private:
	bool _Create(const qgArprBuffer& arpr, D11Device* dev);
};


//////////////////////////////////////////////////////////////////////////
// 레이아웃
class D11Layout : public qgLayout
{
	KCH_SUBCLASS(D11Layout, qgLayout);
	KCH_FRIEND(D11Device);
	KCH_FRIEND(D11Shader);

private:
	tpl::Array<D3D11_INPUT_ELEMENT_DESC> _descs;

private:
	D11Layout() throw();
	~D11Layout() throw();

private:
	bool _Create(qgLayoutData* data);
	bool _BakeShader(qgShader* shd, ID3D11InputLayout** ret, D11Device* dev);

	static LPCSTR _ConvSemanticName(qgDloUsage usage);
	static DXGI_FORMAT _ConvFormat(qgDloType type);
};

#endif	// __INC_QG_D11_DRAW_H__
